package cn.gl.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 工具类;封装增删改返回的结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    //响应给前端判断
    private boolean success =true;
    //响应给前端字符串信息
    private String  msg = "操作成功 ";
    private  Object obj ;

    public AjaxResult(boolean success  ,String msg ) {
        this.success = success;
        this.msg = msg;
    }
    //链式语法的改造
    public static AjaxResult me(){
        return new AjaxResult();
    }
    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }
    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }
    public AjaxResult setObj(Object obj) {
        this.obj = obj;
        return this;
    }


}
